import java.util.*;
import java.lang.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;;

public class Kali extends JFrame {
	
	Container contentpane;
	Panel_1 panel_1 = new Panel_1();
	
	public Kali()
	{
		setTitle("도사관리 프로그램입니다.");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		contentpane = getContentPane();
		contentpane.setLayout(null);
		contentpane.setBackground(Color.white);
		create_menubar();
		
		contentpane.add(panel_1);
		panel_1.setSize(450,400);
		panel_1.setLocation(10,10);
		panel_1.setLayout(null);
		
		setSize(1200,1000);
		setVisible(true);
	}
	
	public static void main(String[]args)
	{
		new Kali();
	}
	
	public void create_menubar()
	{
		JMenuBar MB = new JMenuBar();
		JMenu[] Menulist = {new JMenu("File"), new JMenu("Option")};
		JMenuItem[] File_Item = {new JMenuItem("New"), new JMenuItem("Open"), new JMenuItem("Save"), new JMenuItem("Exit")};
		JMenuItem[] Option_Item ={new JMenuItem("Size"), new JMenuItem("Location")};
		
		for(int i=0; i<File_Item.length; i++)
		{
			Menulist[0].add(File_Item[i]);	
		}
		for(int j=0; j<Option_Item.length;j++)
		{
			Menulist[1].add(Option_Item[j]);
		}
		MB.add(Menulist[0]);
		MB.add(Menulist[1]);
		setJMenuBar(MB);
	}
	
	class Panel_1 extends JPanel
	{
		JLabel ID = new JLabel("ID");
		JLabel Password = new JLabel("Password");
		JTextField[] text = {new JTextField(10), new JTextField(10)};
		JButton login = new JButton("Login");
		JLabel insert = new JLabel("----서비스 목록----");
		
		JButton[] chose = {new JButton("1.도서검색"), new JButton("2.도서등록"), new JButton("3.도서삭제")}; 
		JOptionPane data = new JOptionPane();
		
		Thread_button event = new Thread_button();
		 
		
		public Panel_1()
		{
			setBackground(new Color(250,250,250));
			
			add(ID);
			ID.setLocation(10,10);
			ID.setSize(30,20);
			
			add(text[0]);
			text[0].setLocation(40,10);
			text[0].setSize(100,20);
			
			add(Password);
			Password.setLocation(145,10);
			Password.setSize(70,20);
			
			add(text[1]);
			text[1].setLocation(215,10);
			text[1].setSize(100,20);
			
			add(login);
			login.setLocation(320,10);
			login.setSize(90,20);
			
			add(insert);
			insert.setLocation(20,35);
			insert.setSize(120,30);
			insert.setForeground(new Color(125,125,125));
			
			
			add(chose[0]);
			chose[0].setLocation(20,70);
			chose[0].setSize(98,20);
			
			add(chose[1]);
			chose[1].setLocation(20,100);
			chose[1].setSize(98,20);
			
			add(chose[2]);
			chose[2].setLocation(20,130);
			chose[2].setSize(98,20);
			
			for(int i=0;i<chose.length;i++)
			{
				chose[i].addActionListener(event);
			}
			
			
				
		}
		
		public class Thread_button extends Kali implements ActionListener
		{
			
			public void actionPerformed(ActionEvent e)
			{
				JButton temp = (JButton)e.getSource();
				if(temp.getText().equals("1.도서검색"))
				{
					data.showMessageDialog(null, "도서삭제 메뉴를 선택하셨습니다.");
				}
				else if(temp.getText().equals("2.도서등록"))
				{
					data.showMessageDialog(null, "도서등록 메뉴를 선택하셨습니다.");
				}
				if(temp.getText().equals("3.도서삭제"))
				{
					data.showMessageDialog(null, "도서삭제 메뉴를 선택하셨습니다.");
				}
				
			}
		}
		
	}
}

